#!/usr/bin/env python
# -*- coding: utf-8 -*-
#coding=utf8

# 本文件由自动工具 proto.py 自动生成，请勿修改
# filename msg4000_csbuf.py
# package ptl

from ptl.base_csbuf import *


# message HostAddr
class HostAddr:
	def __init__(self):
		self.protoid = 4008
		self.roomId = 0
		self.port = 0
		self.ip = ""

	def Marshal(writer):
		writer.setUint32(self.roomId, 1)
		writer.setUint32(self.port, 2)
		writer.setString(self.ip, 3)

	def Unmarshal( reader):
		self.roomId = reader.getUint32(1)
		self.port = reader.getUint32(2)
		self.ip = reader.getString(3)
# message Req4001
class Req4001:
	def __init__(self):
		self.protoid = 4001
		self.battleType = 0
		self.perRoundTime = 0
		self.endRoundNum = 0
		self.mapId = ""
		self.playerId = 0
		self.token = ""

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setUint16(self.perRoundTime, 2)
		writer.setUint16(self.endRoundNum, 3)
		writer.setString(self.mapId, 4)
		writer.setUint32(self.playerId, 5)
		writer.setString(self.token, 6)

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		self.perRoundTime = reader.getUint16(2)
		self.endRoundNum = reader.getUint16(3)
		self.mapId = reader.getString(4)
		self.playerId = reader.getUint32(5)
		self.token = reader.getString(6)
# message Resp4001
class Resp4001:
	def __init__(self):
		self.protoid = 4001
		self.roomId = ""
		self.secret = ""
		self.pvpRoomInfo = PVPRoomInfo()

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setString(self.secret, 2)
		writer.setMessage(3)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.secret = reader.getString(2)
		reader.getMessage(3)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Req4002
class Req4002:
	def __init__(self):
		self.protoid = 4002
		self.roomId = ""
		self.roomPlayerInfo = RoomPlayerInfo()

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setMessage(2)
		self.roomPlayerInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		reader.getMessage(2)
		self.roomPlayerInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Resp4002
class Resp4002:
	def __init__(self):
		self.protoid = 4002
		self.roomId = ""
		self.pvpRoomInfo = PVPRoomInfo()

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setMessage(2)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		reader.getMessage(2)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Req4011
class Req4011:
	def __init__(self):
		self.protoid = 4011
		self.battleType = 0
		self.teamId = 0
		self.perRoundTime = 0
		self.endRoundNum = 0
		self.levelId = 0
		self.playerId = 0
		self.token = ""
		self.host = []

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setUint8(self.teamId, 2)
		writer.setUint16(self.perRoundTime, 3)
		writer.setUint16(self.endRoundNum, 4)
		writer.setUint32(self.levelId, 5)
		writer.setUint32(self.playerId, 6)
		writer.setString(self.token, 7)
		counthost = len(self.host)
		writer.setArray(counthost, 8)
		for i in range(counthost):
			writer.setMessage(0)
			self.host[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		self.teamId = reader.getUint8(2)
		self.perRoundTime = reader.getUint16(3)
		self.endRoundNum = reader.getUint16(4)
		self.levelId = reader.getUint32(5)
		self.playerId = reader.getUint32(6)
		self.token = reader.getString(7)
		for i in range(reader.getArray(8)):
			msg = NormalUserInfo() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.host.append(msg)
# message Resp4011
class Resp4011:
	def __init__(self):
		self.protoid = 4011
		self.secret = ""
		self.pvpRoomInfo = PVPRoomInfo()
		self.status = 0
		self.playerId = 0
		self.results = []

	def Marshal(writer):
		writer.setString(self.secret, 1)
		writer.setMessage(2)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()
		writer.setUint8(self.status, 3)
		writer.setUint32(self.playerId, 4)
		countresults = len(self.results)
		writer.setArray(countresults, 5)
		for i in range(countresults):
			writer.setMessage(0)
			self.results[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		self.secret = reader.getString(1)
		reader.getMessage(2)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
		self.status = reader.getUint8(3)
		self.playerId = reader.getUint32(4)
		for i in range(reader.getArray(5)):
			msg = BattleDailyResult() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.results.append(msg)
# message Req4013
class Req4013:
	def __init__(self):
		self.protoid = 4013
		self.heroId = 0
		self.suitId = 0
		self.battleType = 0
		self.roomId = ""
		self.playerId = 0
		self.index = 0

	def Marshal(writer):
		writer.setUint32(self.heroId, 1)
		writer.setUint32(self.suitId, 2)
		writer.setUint8(self.battleType, 3)
		writer.setString(self.roomId, 4)
		writer.setUint32(self.playerId, 5)
		writer.setUint32(self.index, 6)

	def Unmarshal( reader):
		self.heroId = reader.getUint32(1)
		self.suitId = reader.getUint32(2)
		self.battleType = reader.getUint8(3)
		self.roomId = reader.getString(4)
		self.playerId = reader.getUint32(5)
		self.index = reader.getUint32(6)
# message Resp4013
class Resp4013:
	def __init__(self):
		self.protoid = 4013
		self.status = 0
		self.heroId = 0
		self.suitId = 0
		self.battleType = 0
		self.changePlayerId = 0
		self.playerId = 0
		self.index = 0

	def Marshal(writer):
		writer.setUint8(self.status, 1)
		writer.setUint32(self.heroId, 2)
		writer.setUint32(self.suitId, 3)
		writer.setUint32(self.battleType, 4)
		writer.setUint32(self.changePlayerId, 5)
		writer.setUint32(self.playerId, 6)
		writer.setUint32(self.index, 7)

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
		self.heroId = reader.getUint32(2)
		self.suitId = reader.getUint32(3)
		self.battleType = reader.getUint32(4)
		self.changePlayerId = reader.getUint32(5)
		self.playerId = reader.getUint32(6)
		self.index = reader.getUint32(7)
# message Req4014
class Req4014:
	def __init__(self):
		self.protoid = 4014
		self.battleType = 0
		self.props = FightProps()
		self.roomId = ""
		self.playerId = 0
		self.roleSkills = FightSkills()
		self.index = 0

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setMessage(2)
		self.props.Marshal(writer)
		writer.endSetMessage()
		writer.setString(self.roomId, 3)
		writer.setUint32(self.playerId, 4)
		writer.setMessage(5)
		self.roleSkills.Marshal(writer)
		writer.endSetMessage()
		writer.setUint32(self.index, 6)

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		reader.getMessage(2)
		self.props.Unmarshal(reader)
		reader.endGetMessage()
		self.roomId = reader.getString(3)
		self.playerId = reader.getUint32(4)
		reader.getMessage(5)
		self.roleSkills.Unmarshal(reader)
		reader.endGetMessage()
		self.index = reader.getUint32(6)
# message Resp4014
class Resp4014:
	def __init__(self):
		self.protoid = 4014
		self.status = 0
		self.battleType = 0
		self.props = FightProps()
		self.changePlayerId = 0
		self.playerId = 0
		self.roleSkills = FightSkills()
		self.index = 0

	def Marshal(writer):
		writer.setUint8(self.status, 1)
		writer.setUint32(self.battleType, 2)
		writer.setMessage(3)
		self.props.Marshal(writer)
		writer.endSetMessage()
		writer.setUint32(self.changePlayerId, 4)
		writer.setUint32(self.playerId, 5)
		writer.setMessage(6)
		self.roleSkills.Marshal(writer)
		writer.endSetMessage()
		writer.setUint32(self.index, 7)

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
		self.battleType = reader.getUint32(2)
		reader.getMessage(3)
		self.props.Unmarshal(reader)
		reader.endGetMessage()
		self.changePlayerId = reader.getUint32(4)
		self.playerId = reader.getUint32(5)
		reader.getMessage(6)
		self.roleSkills.Unmarshal(reader)
		reader.endGetMessage()
		self.index = reader.getUint32(7)
# message Req4010
class Req4010:
	def __init__(self):
		self.protoid = 4010
		self.battleType = 0
		self.teamId = 0
		self.secret = ""
		self.playerId = 0
		self.levelId = 0
		self.userInfo = NormalUserInfo()

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setUint8(self.teamId, 2)
		writer.setString(self.secret, 3)
		writer.setUint32(self.playerId, 4)
		writer.setUint32(self.levelId, 5)
		writer.setMessage(6)
		self.userInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		self.teamId = reader.getUint8(2)
		self.secret = reader.getString(3)
		self.playerId = reader.getUint32(4)
		self.levelId = reader.getUint32(5)
		reader.getMessage(6)
		self.userInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Resp4010
class Resp4010:
	def __init__(self):
		self.protoid = 4010
		self.pvpRoomInfo = PVPRoomInfo()
		self.playerId = 0
		self.status = 0

	def Marshal(writer):
		writer.setMessage(1)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()
		writer.setUint32(self.playerId, 2)
		writer.setUint8(self.status, 3)

	def Unmarshal( reader):
		reader.getMessage(1)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
		self.playerId = reader.getUint32(2)
		self.status = reader.getUint8(3)
# message Req4003
class Req4003:
	def __init__(self):
		self.protoid = 4003
		self.roomId = ""
		self.playerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint32(self.playerId, 2)
		writer.setUint8(self.battleType, 3)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.playerId = reader.getUint32(2)
		self.battleType = reader.getUint8(3)
# message Resp4003
class Resp4003:
	def __init__(self):
		self.protoid = 4003
		self.playerId = 0
		self.status = 0
		self.quitPlayerId = 0
		self.hostId = 0

	def Marshal(writer):
		writer.setUint32(self.playerId, 1)
		writer.setUint8(self.status, 2)
		writer.setUint32(self.quitPlayerId, 3)
		writer.setUint32(self.hostId, 4)

	def Unmarshal( reader):
		self.playerId = reader.getUint32(1)
		self.status = reader.getUint8(2)
		self.quitPlayerId = reader.getUint32(3)
		self.hostId = reader.getUint32(4)
# message Req4004
class Req4004:
	def __init__(self):
		self.protoid = 4004
		self.status = 0
		self.roomId = ""
		self.playerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setUint8(self.status, 1)
		writer.setString(self.roomId, 2)
		writer.setUint32(self.playerId, 3)
		writer.setUint8(self.battleType, 4)

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
		self.roomId = reader.getString(2)
		self.playerId = reader.getUint32(3)
		self.battleType = reader.getUint8(4)
# message Resp4004
class Resp4004:
	def __init__(self):
		self.protoid = 4004
		self.status = 0
		self.roomId = ""
		self.playerId = 0
		self.readyPlayerId = 0

	def Marshal(writer):
		writer.setUint8(self.status, 1)
		writer.setString(self.roomId, 2)
		writer.setUint32(self.playerId, 3)
		writer.setUint32(self.readyPlayerId, 4)

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
		self.roomId = reader.getString(2)
		self.playerId = reader.getUint32(3)
		self.readyPlayerId = reader.getUint32(4)
# message Req4005
class Req4005:
	def __init__(self):
		self.protoid = 4005
		self.roomId = ""
		self.battleType = 0
		self.op = 0
		self.playerId = 0
		self.pvpType = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint8(self.battleType, 2)
		writer.setUint8(self.op, 3)
		writer.setUint32(self.playerId, 4)
		writer.setUint8(self.pvpType, 5)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.battleType = reader.getUint8(2)
		self.op = reader.getUint8(3)
		self.playerId = reader.getUint32(4)
		self.pvpType = reader.getUint8(5)
# message Resp4005
class Resp4005:
	def __init__(self):
		self.protoid = 4005
		self.pvpRoomInfo = PVPRoomInfo()
		self.status = 0
		self.playerId = 0
		self.op = 0
		self.disPlayerId = 0

	def Marshal(writer):
		writer.setMessage(1)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()
		writer.setUint8(self.status, 2)
		writer.setUint32(self.playerId, 3)
		writer.setUint8(self.op, 4)
		writer.setUint32(self.disPlayerId, 5)

	def Unmarshal( reader):
		reader.getMessage(1)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
		self.status = reader.getUint8(2)
		self.playerId = reader.getUint32(3)
		self.op = reader.getUint8(4)
		self.disPlayerId = reader.getUint32(5)
# message Resp4006
class Resp4006:
	def __init__(self):
		self.protoid = 4006
		self.playerId = 0
		self.pvpRoomInfo = PVPRoomInfo()
		self.results = []

	def Marshal(writer):
		writer.setUint32(self.playerId, 1)
		writer.setMessage(2)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()
		countresults = len(self.results)
		writer.setArray(countresults, 3)
		for i in range(countresults):
			writer.setMessage(0)
			self.results[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		self.playerId = reader.getUint32(1)
		reader.getMessage(2)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
		for i in range(reader.getArray(3)):
			msg = BattleDailyResult() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.results.append(msg)
# message Req4007
class Req4007:
	def __init__(self):
		self.protoid = 4007
		self.percent = 0
		self.roomId = ""
		self.playerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setUint8(self.percent, 1)
		writer.setString(self.roomId, 2)
		writer.setUint32(self.playerId, 3)
		writer.setUint8(self.battleType, 4)

	def Unmarshal( reader):
		self.percent = reader.getUint8(1)
		self.roomId = reader.getString(2)
		self.playerId = reader.getUint32(3)
		self.battleType = reader.getUint8(4)
# message Resp4007
class Resp4007:
	def __init__(self):
		self.protoid = 4007
		self.done = 0
		self.percent = 0
		self.roomId = ""
		self.playerId = 0
		self.loadingPlayerId = 0

	def Marshal(writer):
		writer.setBool(self.done, 1)
		writer.setUint8(self.percent, 2)
		writer.setString(self.roomId, 3)
		writer.setUint32(self.playerId, 4)
		writer.setUint32(self.loadingPlayerId, 5)

	def Unmarshal( reader):
		self.done = reader.getBool(1)
		self.percent = reader.getUint8(2)
		self.roomId = reader.getString(3)
		self.playerId = reader.getUint32(4)
		self.loadingPlayerId = reader.getUint32(5)
# message Req4012
class Req4012:
	def __init__(self):
		self.protoid = 4012
		self.roomId = ""
		self.playerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint32(self.playerId, 2)
		writer.setUint8(self.battleType, 3)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.playerId = reader.getUint32(2)
		self.battleType = reader.getUint8(3)
# message Resp4012
class Resp4012:
	def __init__(self):
		self.protoid = 4012
		self.roomId = ""
		self.playerId = 0
		self.status = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint32(self.playerId, 2)
		writer.setUint8(self.status, 3)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.playerId = reader.getUint32(2)
		self.status = reader.getUint8(3)
# message Req4015
class Req4015:
	def __init__(self):
		self.protoid = 4015
		self.roomId = ""
		self.lock = 0
		self.playerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint32(self.lock, 2)
		writer.setUint32(self.playerId, 3)
		writer.setUint8(self.battleType, 4)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.lock = reader.getUint32(2)
		self.playerId = reader.getUint32(3)
		self.battleType = reader.getUint8(4)
# message Resp4015
class Resp4015:
	def __init__(self):
		self.protoid = 4015
		self.playerId = 0
		self.lock = 0
		self.status = 0

	def Marshal(writer):
		writer.setUint32(self.playerId, 1)
		writer.setUint32(self.lock, 2)
		writer.setUint32(self.status, 3)

	def Unmarshal( reader):
		self.playerId = reader.getUint32(1)
		self.lock = reader.getUint32(2)
		self.status = reader.getUint32(3)
# message Req4016
class Req4016:
	def __init__(self):
		self.protoid = 4016
		self.roomId = ""
		self.playerId = 0
		self.kickOutPlayerId = 0
		self.battleType = 0

	def Marshal(writer):
		writer.setString(self.roomId, 1)
		writer.setUint32(self.playerId, 2)
		writer.setUint32(self.kickOutPlayerId, 3)
		writer.setUint8(self.battleType, 4)

	def Unmarshal( reader):
		self.roomId = reader.getString(1)
		self.playerId = reader.getUint32(2)
		self.kickOutPlayerId = reader.getUint32(3)
		self.battleType = reader.getUint8(4)
# message Resp4016
class Resp4016:
	def __init__(self):
		self.protoid = 4016
		self.playerId = 0
		self.status = 0
		self.pvpRoomInfo = PVPRoomInfo()

	def Marshal(writer):
		writer.setUint32(self.playerId, 1)
		writer.setUint32(self.status, 2)
		writer.setMessage(3)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.playerId = reader.getUint32(1)
		self.status = reader.getUint32(2)
		reader.getMessage(3)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Req4017
class Req4017:
	def __init__(self):
		self.protoid = 4017
		self.battleType = 0
		self.roomId = ""
		self.secret = ""
		self.playerId = 0
		self.userInfo = NormalUserInfo()

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setString(self.roomId, 2)
		writer.setString(self.secret, 3)
		writer.setUint32(self.playerId, 4)
		writer.setMessage(6)
		self.userInfo.Marshal(writer)
		writer.endSetMessage()

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		self.roomId = reader.getString(2)
		self.secret = reader.getString(3)
		self.playerId = reader.getUint32(4)
		reader.getMessage(6)
		self.userInfo.Unmarshal(reader)
		reader.endGetMessage()
# message Resp4017
class Resp4017:
	def __init__(self):
		self.protoid = 4017
		self.pvpRoomInfo = PVPRoomInfo()
		self.playerId = 0
		self.enterPlayerId = 0
		self.status = 0
		self.results = []

	def Marshal(writer):
		writer.setMessage(1)
		self.pvpRoomInfo.Marshal(writer)
		writer.endSetMessage()
		writer.setUint32(self.playerId, 2)
		writer.setUint32(self.enterPlayerId, 3)
		writer.setUint8(self.status, 4)
		countresults = len(self.results)
		writer.setArray(countresults, 5)
		for i in range(countresults):
			writer.setMessage(0)
			self.results[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		reader.getMessage(1)
		self.pvpRoomInfo.Unmarshal(reader)
		reader.endGetMessage()
		self.playerId = reader.getUint32(2)
		self.enterPlayerId = reader.getUint32(3)
		self.status = reader.getUint8(4)
		for i in range(reader.getArray(5)):
			msg = BattleDailyResult() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.results.append(msg)
# message Req4018
class Req4018:
	def __init__(self):
		self.protoid = 4018
		self.battleType = 0
		self.roomId = ""
		self.instId = 0
		self.target_playerIds = []
		self.op = 0

	def Marshal(writer):
		writer.setUint8(self.battleType, 1)
		writer.setString(self.roomId, 2)
		writer.setUint32(self.instId, 3)
		counttarget_playerIds = len(self.target_playerIds)
		writer.setArray(counttarget_playerIds, 4)
		for i in range(counttarget_playerIds):
			writer.setUint32(self.target_playerIds[i], 0)
		writer.setUint8(self.op, 5)

	def Unmarshal( reader):
		self.battleType = reader.getUint8(1)
		self.roomId = reader.getString(2)
		self.instId = reader.getUint32(3)
		for i in range(reader.getArray(4)):
			self.target_playerIds.append(reader.getUint32(0))
		self.op = reader.getUint8(5)
# message Resp4018
class Resp4018:
	def __init__(self):
		self.protoid = 4018
		self.status = 0

	def Marshal(writer):
		writer.setUint8(self.status, 1)

	def Unmarshal( reader):
		self.status = reader.getUint8(1)
# message Resp4019
class Resp4019:
	def __init__(self):
		self.protoid = 4019
		self.list = []

	def Marshal(writer):
		countlist = len(self.list)
		writer.setArray(countlist, 1)
		for i in range(countlist):
			writer.setMessage(0)
			self.list[i].Marshal(writer)
			writer.endSetMessage()

	def Unmarshal( reader):
		for i in range(reader.getArray(1)):
			msg = ChatInfo() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.list.append(msg)
# message BattleReBox
class BattleReBox:
	def __init__(self):
		self.protoid = 0
		self.type = 0
		self.count = 0
		self.time = 0
		self.index = 0
		self.rewardT = 0
		self.win = 0
		self.kill = 0

	def Marshal(writer):
		writer.setUint8(self.type, 1)
		writer.setUint32(self.count, 2)
		writer.setUint32(self.time, 3)
		writer.setUint8(self.index, 4)
		writer.setUint8(self.rewardT, 5)
		writer.setUint8(self.win, 6)
		writer.setUint8(self.kill, 7)

	def Unmarshal( reader):
		self.type = reader.getUint8(1)
		self.count = reader.getUint32(2)
		self.time = reader.getUint32(3)
		self.index = reader.getUint8(4)
		self.rewardT = reader.getUint8(5)
		self.win = reader.getUint8(6)
		self.kill = reader.getUint8(7)
# message Req4020
class Req4020:
	def __init__(self):
		self.protoid = 4020
		self.type = 0
		self.rewardType = 0

	def Marshal(writer):
		writer.setUint8(self.type, 1)
		writer.setUint8(self.rewardType, 2)

	def Unmarshal( reader):
		self.type = reader.getUint8(1)
		self.rewardType = reader.getUint8(2)
# message Resp4020
class Resp4020:
	def __init__(self):
		self.protoid = 4020
		self.score = 0
		self.battleBoxs = []
		self.status = 0

	def Marshal(writer):
		writer.setUint32(self.score, 1)
		countbattleBoxs = len(self.battleBoxs)
		writer.setArray(countbattleBoxs, 2)
		for i in range(countbattleBoxs):
			writer.setMessage(0)
			self.battleBoxs[i].Marshal(writer)
			writer.endSetMessage()
		writer.setUint8(self.status, 3)

	def Unmarshal( reader):
		self.score = reader.getUint32(1)
		for i in range(reader.getArray(2)):
			msg = BattleReBox() 
			reader.getMessage(0)
			msg.Unmarshal(reader)
			reader.endGetMessage()
			self.battleBoxs.append(msg)
		self.status = reader.getUint8(3)
